package com.dxh.common;

import java.util.Random;

/**
 * 生成验证码的工具类
 * @author yxd
 *
 * 2015年1月13日
 */


public class CodeUtil {

	//0-9的字符数组
	private static String[] num = {"0","1","2","3","4","5","6","7","8","9"};
	
	public static String CreateCode(){
		String code = "";
		for(int i=0;i<6;i++){
			//获取0-10之间的随机数
			Random rand = new Random();
			code += ""+num[rand.nextInt(9)+1];
		}
		return code;
	}
	
	/*public static void main(String[] args) throws Exception {
		System.out.println(""+CreateCode());
	}*/
}
